<template>
	<view class="flex-col homepage">
		<view class="flex-col wrapper" v-for="iterm in data">
			<view class="flex-row wraper-row">
				<view class="u-line-1 text">待缴金额</view>
				<view class="u-line-1 text-two">{{iterm.visitorsLicencePlate}}</view>
			</view>
			<view class="u-line-1 text-three">{{iterm.money}}￥</view>
			<u-line class="line" margin="0rpx 0rpx 16rpx 0rpx"></u-line>
			<view class="flex-row wraper-row-two">
				<view class="u-line-1 text-four">停车地点</view>
				<view class="u-line-1 text-five">{{iterm.communityName}}停车场</view>
			</view>
			<view class="flex-row wraper-row-three">
				<view class="u-line-1 text-six">停车时间</view>
				<view class="u-line-1 text-seven">{{iterm.accessTime}}</view>
			</view>
			<view class="flex-row wraper-row-four">
				<view class="u-line-1 text-eight">停车时长</view>
				<view class="u-line-1 text-nine">{{iterm.duration}}h</view>
			</view>
			<u-button class="button" type="success" size="medium" @click="jiaofei(iterm)">
				立即缴费
			</u-button>
		</view>

		<u-popup :show="show" mode="center">
			<view style="width: 200px;height: 70px;">
				<text>确定缴费？</text>
			</view>
			<u-button type="warning" text="取消" class="qq" @click="quxiao"></u-button>
			<u-button type="primary" text="确定" class="qq2" @click="queding"></u-button>
		</u-popup>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				user: {},
				data: {},
				show: false,
				data2: {}
			}
		},
		onLoad() {
			this.user = uni.getStorageSync('user')
			this.findTCJF()
		},
		methods: {
			findTCJF() {
				this.$axios({
					url: 'serverwg/findTCJF',
					data: {
						userId: this.user.userId
					},
					method: 'GET',
					success: (res) => {
						this.data = res.data.data.data
					}
				})
			},
			jiaofei(iterm) {
				this.data2 = iterm
				console.log(this.data2)
				this.show = true
			},
			quxiao() {
				this.show = false
			},
			queding() {
				this.show = false
				this.$axios({
					url: 'serverwg/WjxStartJF',
					data: this.data2,
					method: 'POST',
					success: (res) => {
						if (res.data.code == 2000) {
							alert("缴费成功")
							uni.navigateTo({
								url: "../service"
							})
						} else if (res.data.code == 5000) {
							alert("缴费失败")
						}

					}
				})

			}
		}
	}
</script>
<style lang="scss" scoped>
	/** 全局样式-开始,建议放在公共css样式文件中,比如common.css 或app.vue文件 */
	.qq {
		float: left;
		width: 80px;
		margin-left: 10px;
		margin-bottom: -40px;
	}

	.qq2 {
		float: left;
		width: 80px;
		margin-right: 10px;
	}

	html,
	body {
		margin: 0;
		width: 100%;
		height: 100%;
		font-size: 16px
	}

	view,
	text,
	image {
		position: relative;
		box-sizing: border-box;
		flex-shrink: 0;
	}

	.flex-col {
		display: flex;
		align-items: flex-start;
		flex-direction: column;
	}

	.flex-row {
		display: flex;
		align-items: flex-start;
	}

	.flex-col .flex-row {
		width: 100%
	}

	/** 全局样式-结束*/

	.homepage {
		height: 1334rpx;
		padding: 30rpx 0rpx 0rpx 18rpx;

		.wrapper {
			width: 706rpx;
			margin-bottom: 20rpx;
			padding: 28rpx 0rpx 18rpx 0rpx;
			border-width: 2rpx;
			border-style: solid;
			border-color: #909399;

			.wraper-row {
				width: 680rpx;
				justify-content: space-between;
				margin-left: 22rpx;

				.text {
					width: 146rpx;
				}

				.text-two {
					width: 158rpx;
					color: #71d5a1;
				}
			}

			.text-three {
				width: 142rpx;
				margin: 0rpx 0rpx 6rpx 22rpx;
				color: rgba(255, 0, 0, 1);
			}

			.line {
				width: 702rpx;
				border-width: 2rpx;
			}

			.wraper-row-two {
				width: 414rpx;
				margin: 0rpx 0rpx 14rpx 30rpx;

				.text-four {
					width: 126rpx;
					margin-right: -10rpx;
					font-size: 16rpx;
					color: #909399;
				}

				.text-five {
					width: 298rpx;
					font-size: 16rpx;
					color: #303133;
				}
			}

			.wraper-row-three {
				width: 390rpx;
				margin: 0rpx 0rpx 10rpx 30rpx;

				.text-six {
					width: 126rpx;
					margin-right: -10rpx;
					font-size: 16rpx;
					color: #909399;
				}

				.text-seven {
					width: 274rpx;
					font-size: 16rpx;
					color: #303133;
				}
			}

			.wraper-row-four {
				width: 242rpx;
				margin: 0rpx 0rpx 10rpx 30rpx;

				.text-eight {
					width: 126rpx;
					margin-right: -10rpx;
					font-size: 16rpx;
					color: #909399;
				}

				.text-nine {
					width: 126rpx;
					font-size: 16rpx;
					color: #303133;
				}
			}

			.button {
				width: 656rpx;
				display: block;
				margin-right: auto;
				margin-left: auto;
				background: #2979ff;
			}
		}

		.wrapper-two {
			width: 706rpx;
			padding: 28rpx 0rpx 18rpx 0rpx;
			border-width: 2rpx;
			border-style: solid;
			border-color: #909399;

			.text-ten {
				width: 146rpx;
				margin: 0rpx 0rpx -38rpx 22rpx;
			}

			.text-eleven {
				width: 158rpx;
				margin-left: 544rpx;
				color: #71d5a1;
			}

			.text-twelve {
				width: 142rpx;
				margin: 0rpx 0rpx 6rpx 22rpx;
				color: rgba(255, 0, 0, 1);
			}

			.line {
				width: 702rpx;
				border-width: 2rpx;
			}

			.text-thirteen {
				width: 126rpx;
				margin: 0rpx 0rpx -38rpx 30rpx;
				font-size: 16rpx;
				color: #909399;
			}

			.text-fourteen {
				width: 298rpx;
				margin: 0rpx 0rpx 14rpx 146rpx;
				font-size: 16rpx;
				color: #303133;
			}

			.text-fifteen {
				width: 126rpx;
				margin: 0rpx 0rpx -38rpx 30rpx;
				font-size: 16rpx;
				color: #909399;
			}

			.text-sixteen {
				width: 274rpx;
				margin: 0rpx 0rpx 10rpx 146rpx;
				font-size: 16rpx;
				color: #303133;
			}

			.text-seventeen {
				width: 126rpx;
				margin: 0rpx 0rpx -38rpx 30rpx;
				font-size: 16rpx;
				color: #909399;
			}

			.text-eighteen {
				width: 126rpx;
				margin: 0rpx 0rpx 10rpx 146rpx;
				font-size: 16rpx;
				color: #303133;
			}

			.button {
				width: 656rpx;
				display: block;
				margin-right: auto;
				margin-left: auto;
				background: #2979ff;
			}
		}
	}
</style>
